package com.example.androidproject.widget;

import android.content.Context;
import android.net.Uri;
import android.util.AttributeSet;
import android.widget.VideoView;

import com.hyg.common.utils.SSLSocketClient;

import javax.net.ssl.HttpsURLConnection;

/**
 * FileName: MyVideoView
 * Author: huangyuguang
 * Date: 2022/10/7
 * Description: 视频播放器
 */
public class MyVideoView extends VideoView {
    public MyVideoView(Context context) {
        super(context);
    }

    public MyVideoView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public MyVideoView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    public void setVideoURI(Uri uri) {
        super.setVideoURI(uri);
        try {
            HttpsURLConnection.setDefaultSSLSocketFactory(SSLSocketClient.getSSLSocketFactory());
            HttpsURLConnection.setDefaultHostnameVerifier(SSLSocketClient.getHostnameVerifier());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}